package com.fw.ui.view.settings.usercontrol.parentmerchant;

import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;

import com.fw.service.bean.EntryBean;
import com.fw.ui.bao.MasterDataBAO;
import com.fw.ui.bao.MerchantProfileBAO;
import com.fw.ui.bao.MessageBAO;
import com.fw.ui.bao.ParentMerchantBAO;
import com.fw.ui.bao.PropertyBAO;
import com.fw.ui.bean.parentmerchant.SearchMerchantProfileTableItemBean;
import com.fw.ui.util.UICommonUtils;
import com.fw.ui.util.VaadinApplicationObjectSupport;
import com.fw.ui.view.common.TablePanel;
import com.fw.ui.view.common.util.TableHeaderProperty;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.ConfirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
import com.fw.ui.view.settings.usercontrol.parentmerchant.event.ConfirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;
import com.vaadin.data.util.BeanItem;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table.Align;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

@org.springframework.stereotype.Component
@Scope(SCOPE_PROTOTYPE)
public class ConfirmParentMerchantLayout extends VerticalLayout implements InitializingBean {

    @Override
    public void afterPropertiesSet() throws Exception {
	this.init();
	this.initListener();
	this.initValidator();
	this.initData();
	this.updateStrings();
    }

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Autowired
    protected transient VaadinApplicationObjectSupport app;

    @Autowired
    private MasterDataBAO masterDataBAO;
    @Autowired
    private PropertyBAO propertyBAO;
    @Autowired
    private MessageBAO messageBAO;
    @Autowired
    private MerchantProfileBAO merchantProfileBAO;
    @Autowired
    private ParentMerchantBAO parentMerchantBAO;
    @Autowired
    private UICommonUtils uiCommonUtils;
    /**
     * BEAN
     */
    @SuppressWarnings("rawtypes")
    private Map<Long, BeanItem> selectedBeanItemMap = new LinkedHashMap<Long, BeanItem>();
    /**
     * EVENT
     */
    @Autowired
    private ConfirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
    @Autowired
    private ConfirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;

    /**
     * COMPONENT
     */
    private Panel confirmParentMerchantProfilePanel = new Panel();
    private Panel confirmParentMerchantContactPersonPanel = new Panel();
    private Panel createMerchantMemberPanel = new Panel();

    private GridLayout gridParentMerchantPanelLayout = new GridLayout(1, 4);
    private GridLayout gridParentMerchantProfileLayout = new GridLayout(4, 4);
    private GridLayout gridParentMerchantContactPersonLayout = new GridLayout(4, 5);
    private GridLayout gridParentMerchantMemberLayout = new GridLayout(1, 1);

    private Label lblParentMerchantID = new Label();
    private Label lblParentMerchantName = new Label();
    private Label lblBusinessAddress = new Label();
    private Label lblParentStatus = new Label();
    private Label lblTitle = new Label();
    private Label lblFirstName = new Label();
    private Label lblLastName = new Label();
    private Label lblTelephoneNumber = new Label();
    private Label lblEmailAddress = new Label();

    private TextField txtParentMerchantID = new TextField();
    private TextField txtParentMerchantName = new TextField();
    private TextArea txtBusinessAddress = new TextArea();
    private ComboBox cbbParentStatus = new ComboBox();
    private ComboBox cbbTitle = new ComboBox();
    private TextField txtFirstName = new TextField();
    private TextField txtLastName = new TextField();
    private TextField txtTelephoneNumber = new TextField();
    private TextField txtEmailAddress = new TextField();

    @Autowired
    protected TablePanel tableMerchantSelectedPanel;
    private TableHeaderProperty hNoSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantIDSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantCompanyNameSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantUrlSelected = new TableHeaderProperty();
    private TableHeaderProperty hMerchantContactPersonSelected = new TableHeaderProperty();

    public void updateStrings() {

	this.confirmParentMerchantProfilePanel
		.setCaption(this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.panel.confirmParentMerchantProfilePanel"));
	this.confirmParentMerchantContactPersonPanel
		.setCaption(this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.panel.confirmParentMerchantContactPersonPanel"));
	this.createMerchantMemberPanel
		.setCaption(this.messageBAO
			.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.panel.confirmMerchantMemberPanel"));
	this.tableMerchantSelectedPanel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.panel.parentMerchantMember"));

	this.lblParentMerchantID.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.parentMerchantID"));
	this.lblParentMerchantName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.parentMerchantName"));
	this.lblBusinessAddress.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.businessAddress"));
	this.lblParentStatus.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.parentStatus"));
	this.lblTitle.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.title"));
	this.lblFirstName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.firstName"));
	this.lblLastName.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.lastName"));
	this.lblTelephoneNumber.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.telephoneNumber"));
	this.lblEmailAddress.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.label.emailAddress"));

	this.hNoSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.header.no"));
	this.hMerchantIDSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.header.merchantID"));
	this.hMerchantCompanyNameSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.header.merchantCompnayName"));
	this.hMerchantUrlSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.header.merchantUrl"));
	this.hMerchantContactPersonSelected.setColumnName(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.header.merchantContactPerson"));

	tableMerchantSelectedPanel.setTableColumnHeader(this.hNoSelected.getColumnId(), this.hNoSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantIDSelected.getColumnId(), this.hMerchantIDSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantCompanyNameSelected.getColumnId(),
		this.hMerchantCompanyNameSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantUrlSelected.getColumnId(), this.hMerchantUrlSelected.getColumnName());
	tableMerchantSelectedPanel.setTableColumnHeader(this.hMerchantContactPersonSelected.getColumnId(),
		this.hMerchantContactPersonSelected.getColumnName());

    }

    public void init() {
	setWidth(100, Unit.PERCENTAGE);
	setHeightUndefined();

	confirmParentMerchantProfilePanel.setSizeFull();
	confirmParentMerchantProfilePanel.setId("confirmParentMerchantProfilePanel");

	confirmParentMerchantContactPersonPanel.setSizeFull();
	confirmParentMerchantContactPersonPanel.setId("confirmParentMerchantContactPersonPanel");

	createMerchantMemberPanel.setSizeFull();
	createMerchantMemberPanel.setId("createMerchantMemberPanel");

	String labelWidth = "150px";
	lblParentMerchantID.setWidth(labelWidth);
	lblParentMerchantName.setWidth(labelWidth);
	lblBusinessAddress.setWidth(labelWidth);
	lblParentStatus.setWidth(labelWidth);
	lblTitle.setWidth(labelWidth);
	lblFirstName.setWidth(labelWidth);
	lblLastName.setWidth(labelWidth);
	lblTelephoneNumber.setWidth(labelWidth);
	lblEmailAddress.setWidth(labelWidth);

	String inputWidth = "200px";
	txtParentMerchantID.setWidth(inputWidth);
	txtParentMerchantName.setWidth(inputWidth);
	txtBusinessAddress.setWidth(inputWidth);
	cbbParentStatus.setWidth(inputWidth);
	cbbTitle.setWidth(inputWidth);
	txtFirstName.setWidth(inputWidth);
	txtLastName.setWidth(inputWidth);
	txtTelephoneNumber.setWidth(inputWidth);
	txtEmailAddress.setWidth(inputWidth);

	gridParentMerchantPanelLayout.setSizeFull();
	gridParentMerchantPanelLayout.addComponent(confirmParentMerchantProfilePanel, 0, 0);
	gridParentMerchantPanelLayout.setComponentAlignment(confirmParentMerchantProfilePanel, Alignment.TOP_CENTER);
	gridParentMerchantPanelLayout.addComponent(createMerchantMemberPanel, 0, 1);
	gridParentMerchantPanelLayout.setComponentAlignment(createMerchantMemberPanel, Alignment.TOP_CENTER);
	gridParentMerchantPanelLayout.addComponent(confirmParentMerchantContactPersonPanel, 0, 2);
	gridParentMerchantPanelLayout.setComponentAlignment(confirmParentMerchantContactPersonPanel, Alignment.TOP_CENTER);
	VerticalLayout confirmLabelLayout = new VerticalLayout();
	confirmLabelLayout.setSizeFull();
	confirmLabelLayout.setSpacing(true);
	confirmLabelLayout.setMargin(true);
	Label lblRegisterConfirm = new Label("", ContentMode.HTML);
	lblRegisterConfirm.setSizeUndefined();
	lblRegisterConfirm.setValue(messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.message.confirm.label"));
	confirmLabelLayout.addComponent(lblRegisterConfirm);
	confirmLabelLayout.setComponentAlignment(lblRegisterConfirm, Alignment.TOP_CENTER);
	gridParentMerchantPanelLayout.addComponent(confirmLabelLayout, 0, 3);
	gridParentMerchantPanelLayout.setComponentAlignment(confirmLabelLayout, Alignment.TOP_CENTER);

	confirmParentMerchantProfilePanel.setContent(gridParentMerchantProfileLayout);
	gridParentMerchantProfileLayout.setSizeFull();
	gridParentMerchantProfileLayout.setSpacing(true);
	gridParentMerchantProfileLayout.setMargin(true);
	gridParentMerchantProfileLayout.setColumnExpandRatio(0, 10);
	gridParentMerchantProfileLayout.setColumnExpandRatio(1, 20);
	gridParentMerchantProfileLayout.setColumnExpandRatio(2, 60);
	gridParentMerchantProfileLayout.setColumnExpandRatio(3, 10);
	gridParentMerchantProfileLayout.setRowExpandRatio(0, 2);
	gridParentMerchantProfileLayout.setRowExpandRatio(1, 1);
	gridParentMerchantProfileLayout.setRowExpandRatio(2, 1);
	gridParentMerchantProfileLayout.setRowExpandRatio(3, 2);
	gridParentMerchantProfileLayout.addComponent(lblParentMerchantID, 1, 0);
	gridParentMerchantProfileLayout.setComponentAlignment(lblParentMerchantID, Alignment.TOP_LEFT);
	VerticalLayout parentMerchantIdLayout = new VerticalLayout();
	parentMerchantIdLayout.addComponent(txtParentMerchantID);
	gridParentMerchantProfileLayout.addComponent(parentMerchantIdLayout, 2, 0);
	gridParentMerchantProfileLayout.setComponentAlignment(parentMerchantIdLayout, Alignment.TOP_LEFT);
	gridParentMerchantProfileLayout.addComponent(lblParentMerchantName, 1, 1);
	gridParentMerchantProfileLayout.setComponentAlignment(lblParentMerchantName, Alignment.TOP_LEFT);
	VerticalLayout parentMerchantNameLayout = new VerticalLayout();
	parentMerchantNameLayout.addComponent(txtParentMerchantName);
	gridParentMerchantProfileLayout.addComponent(parentMerchantNameLayout, 2, 1);
	gridParentMerchantProfileLayout.setComponentAlignment(parentMerchantNameLayout, Alignment.TOP_LEFT);
	gridParentMerchantProfileLayout.addComponent(lblBusinessAddress, 1, 2);
	gridParentMerchantProfileLayout.setComponentAlignment(lblBusinessAddress, Alignment.TOP_LEFT);
	VerticalLayout businessAddressLayout = new VerticalLayout();
	businessAddressLayout.addComponent(txtBusinessAddress);
	gridParentMerchantProfileLayout.addComponent(businessAddressLayout, 2, 2);
	gridParentMerchantProfileLayout.setComponentAlignment(businessAddressLayout, Alignment.TOP_LEFT);
	gridParentMerchantProfileLayout.addComponent(lblParentStatus, 1, 3);
	gridParentMerchantProfileLayout.setComponentAlignment(lblParentStatus, Alignment.TOP_LEFT);
	VerticalLayout parentStatusLayout = new VerticalLayout();
	parentStatusLayout.addComponent(cbbParentStatus);
	gridParentMerchantProfileLayout.addComponent(parentStatusLayout, 2, 3);
	gridParentMerchantProfileLayout.setComponentAlignment(parentStatusLayout, Alignment.TOP_LEFT);

	confirmParentMerchantContactPersonPanel.setContent(gridParentMerchantContactPersonLayout);
	gridParentMerchantContactPersonLayout.setSizeFull();
	gridParentMerchantContactPersonLayout.setSpacing(true);
	gridParentMerchantContactPersonLayout.setMargin(true);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(0, 10);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(1, 20);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(2, 60);
	gridParentMerchantContactPersonLayout.setColumnExpandRatio(3, 10);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(0, 2);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(1, 1);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(2, 1);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(3, 1);
	gridParentMerchantContactPersonLayout.setRowExpandRatio(4, 2);
	gridParentMerchantContactPersonLayout.addComponent(lblTitle, 1, 0);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblTitle, Alignment.TOP_LEFT);
	VerticalLayout titleLayout = new VerticalLayout();
	titleLayout.addComponent(cbbTitle);
	gridParentMerchantContactPersonLayout.addComponent(titleLayout, 2, 0);
	gridParentMerchantContactPersonLayout.setComponentAlignment(titleLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblFirstName, 1, 1);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblFirstName, Alignment.TOP_LEFT);
	VerticalLayout firstNameLayout = new VerticalLayout();
	firstNameLayout.addComponent(txtFirstName);
	gridParentMerchantContactPersonLayout.addComponent(firstNameLayout, 2, 1);
	gridParentMerchantContactPersonLayout.setComponentAlignment(firstNameLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblLastName, 1, 2);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblLastName, Alignment.TOP_LEFT);
	VerticalLayout lastNameLayout = new VerticalLayout();
	lastNameLayout.addComponent(txtLastName);
	gridParentMerchantContactPersonLayout.addComponent(lastNameLayout, 2, 2);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lastNameLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblTelephoneNumber, 1, 3);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblTelephoneNumber, Alignment.TOP_LEFT);
	VerticalLayout telephoneNumberLayout = new VerticalLayout();
	telephoneNumberLayout.addComponent(txtTelephoneNumber);
	gridParentMerchantContactPersonLayout.addComponent(telephoneNumberLayout, 2, 3);
	gridParentMerchantContactPersonLayout.setComponentAlignment(telephoneNumberLayout, Alignment.TOP_LEFT);
	gridParentMerchantContactPersonLayout.addComponent(lblEmailAddress, 1, 4);
	gridParentMerchantContactPersonLayout.setComponentAlignment(lblEmailAddress, Alignment.TOP_LEFT);
	VerticalLayout emailAddressLayout = new VerticalLayout();
	emailAddressLayout.addComponent(txtEmailAddress);
	gridParentMerchantContactPersonLayout.addComponent(emailAddressLayout, 2, 4);
	gridParentMerchantContactPersonLayout.setComponentAlignment(emailAddressLayout, Alignment.TOP_LEFT);

	createMerchantMemberPanel.setContent(gridParentMerchantMemberLayout);
	gridParentMerchantMemberLayout.setSizeFull();
	gridParentMerchantMemberLayout.setSpacing(true);

	hNoSelected.setColumnId("seqNo");
	hNoSelected.setType(Integer.class);
	hNoSelected.setAlignment(Align.CENTER);
	hNoSelected.setDefaultValue(null);
	hNoSelected.setIconResource(null);
	hNoSelected.setWidth(50);
	hNoSelected.setOrder(1);

	hMerchantIDSelected.setColumnId("merchantID");
	hMerchantIDSelected.setType(String.class);
	hMerchantIDSelected.setAlignment(Align.LEFT);
	hMerchantIDSelected.setDefaultValue(null);
	hMerchantIDSelected.setIconResource(null);
	hMerchantIDSelected.setWidth(100);
	hMerchantIDSelected.setOrder(1);

	hMerchantCompanyNameSelected.setColumnId("merchantCompnayName");
	hMerchantCompanyNameSelected.setType(String.class);
	hMerchantCompanyNameSelected.setAlignment(Align.LEFT);
	hMerchantCompanyNameSelected.setDefaultValue(null);
	hMerchantCompanyNameSelected.setIconResource(null);
	hMerchantCompanyNameSelected.setWidth(200);
	hMerchantCompanyNameSelected.setOrder(3);

	hMerchantUrlSelected.setColumnId("merchantUrl");
	hMerchantUrlSelected.setType(String.class);
	hMerchantUrlSelected.setAlignment(Align.LEFT);
	hMerchantUrlSelected.setDefaultValue(null);
	hMerchantUrlSelected.setIconResource(null);
	hMerchantUrlSelected.setOrder(4);

	hMerchantContactPersonSelected.setColumnId("merchantContactPerson");
	hMerchantContactPersonSelected.setType(String.class);
	hMerchantContactPersonSelected.setAlignment(Align.LEFT);
	hMerchantContactPersonSelected.setDefaultValue(null);
	hMerchantContactPersonSelected.setIconResource(null);
	hMerchantContactPersonSelected.setWidth(200);
	hMerchantContactPersonSelected.setOrder(5);

	List<TableHeaderProperty> headerSelectedProperties = new ArrayList<TableHeaderProperty>();
	headerSelectedProperties.add(hNoSelected);
	headerSelectedProperties.add(hMerchantIDSelected);
	headerSelectedProperties.add(hMerchantCompanyNameSelected);
	headerSelectedProperties.add(hMerchantUrlSelected);
	headerSelectedProperties.add(hMerchantContactPersonSelected);

	tableMerchantSelectedPanel.setTableBeanContainerColumnHeader(headerSelectedProperties, SearchMerchantProfileTableItemBean.class);
	tableMerchantSelectedPanel.setRowIndexVisiblePageNumber();
	tableMerchantSelectedPanel.setTableSelect(false);
	tableMerchantSelectedPanel.setAllowSortRecord(false);
	tableMerchantSelectedPanel.setEnableTableSorting(false);
	tableMerchantSelectedPanel.setTableColumnReordering(false);
	tableMerchantSelectedPanel.createControlTablePageNumber();

	gridParentMerchantMemberLayout.addComponent(tableMerchantSelectedPanel, 0, 0);
	gridParentMerchantMemberLayout.setComponentAlignment(tableMerchantSelectedPanel, Alignment.TOP_CENTER);

	this.addComponent(this.gridParentMerchantPanelLayout);
	this.setComponentAlignment(this.gridParentMerchantPanelLayout, Alignment.TOP_CENTER);
    }

    public void initListener() {
	this.confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener.setBasedComponent(this);
	this.confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener.setBasedComponent(this);

	this.confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener.setTablePanel(this.tableMerchantSelectedPanel);
	this.confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener.setTablePanel(this.tableMerchantSelectedPanel);
	this.tableMerchantSelectedPanel
		.addPageTableButtonClickListener(this.confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener);
	this.tableMerchantSelectedPanel
		.addSizeTableValueChangeListener(this.confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener);
    }

    public void initValidator() {
    }

    public void initData() {
	try {
	    List<String> excludeStatus = Arrays
		    .asList(new String[] {
			    propertyBAO
				    .getPropertyValue("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.exclude.parentStatus.item.inactive"),
			    propertyBAO
				    .getPropertyValue("com.fw.ui.view.settings.usercontrol.parentmerchant.ConfirmParentMerchanLayout.exclude.parentStatus.item.closed") });
	    List<EntryBean<String, String>> masterData = this.masterDataBAO.selectAllParentMerchantStatus();
	    if (masterData != null) {
		for (EntryBean<String, String> entry : masterData) {
		    if (!excludeStatus.contains(entry.getKey())) {
			this.cbbParentStatus.addItem(entry.getKey());
			this.cbbParentStatus.setItemCaption(entry.getKey(), entry.getValue());
		    }
		}
	    }

	    masterData = this.masterDataBAO.selectAllTitleName();
	    if (masterData != null) {
		for (EntryBean<String, String> entry : masterData) {
		    this.cbbTitle.addItem(entry.getKey());
		    this.cbbTitle.setItemCaption(entry.getKey(), entry.getValue());
		}
	    }

	    this.tableMerchantSelectedPanel.clearTableData();

	    uiCommonUtils.setEnableAllUIComponent(confirmParentMerchantProfilePanel, false);
	    uiCommonUtils.setEnableAllUIComponent(confirmParentMerchantContactPersonPanel, false);

	} catch (Exception e) {
	    e.printStackTrace();
	}
    }

    public VaadinApplicationObjectSupport getApp() {
	return app;
    }

    public MasterDataBAO getMasterDataBAO() {
	return masterDataBAO;
    }

    public PropertyBAO getPropertyBAO() {
	return propertyBAO;
    }

    public MessageBAO getMessageBAO() {
	return messageBAO;
    }

    public MerchantProfileBAO getMerchantProfileBAO() {
	return merchantProfileBAO;
    }

    public ParentMerchantBAO getParentMerchantBAO() {
	return parentMerchantBAO;
    }

    public ConfirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener getConfirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener() {
	return confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
    }

    public void setConfirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener(
	    ConfirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener) {
	this.confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener = confirmParentMerchantSelectedMerchantProfileTablePageButtonClickListener;
    }

    public ConfirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener getConfirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener() {
	return confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;
    }

    public void setConfirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener(
	    ConfirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener) {
	this.confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener = confirmParentMerchantSelectedMerchantProfileTableSizeValueChangeListener;
    }

    public Panel getConfirmParentMerchantProfilePanel() {
	return confirmParentMerchantProfilePanel;
    }

    public void setConfirmParentMerchantProfilePanel(Panel confirmParentMerchantProfilePanel) {
	this.confirmParentMerchantProfilePanel = confirmParentMerchantProfilePanel;
    }

    public Panel getConfirmParentMerchantContactPersonPanel() {
	return confirmParentMerchantContactPersonPanel;
    }

    public void setConfirmParentMerchantContactPersonPanel(Panel confirmParentMerchantContactPersonPanel) {
	this.confirmParentMerchantContactPersonPanel = confirmParentMerchantContactPersonPanel;
    }

    public Panel getCreateMerchantMemberPanel() {
	return createMerchantMemberPanel;
    }

    public void setCreateMerchantMemberPanel(Panel createMerchantMemberPanel) {
	this.createMerchantMemberPanel = createMerchantMemberPanel;
    }

    public GridLayout getGridParentMerchantPanelLayout() {
	return gridParentMerchantPanelLayout;
    }

    public void setGridParentMerchantPanelLayout(GridLayout gridParentMerchantPanelLayout) {
	this.gridParentMerchantPanelLayout = gridParentMerchantPanelLayout;
    }

    public GridLayout getGridParentMerchantProfileLayout() {
	return gridParentMerchantProfileLayout;
    }

    public void setGridParentMerchantProfileLayout(GridLayout gridParentMerchantProfileLayout) {
	this.gridParentMerchantProfileLayout = gridParentMerchantProfileLayout;
    }

    public GridLayout getGridParentMerchantContactPersonLayout() {
	return gridParentMerchantContactPersonLayout;
    }

    public void setGridParentMerchantContactPersonLayout(GridLayout gridParentMerchantContactPersonLayout) {
	this.gridParentMerchantContactPersonLayout = gridParentMerchantContactPersonLayout;
    }

    public GridLayout getGridParentMerchantMemberLayout() {
	return gridParentMerchantMemberLayout;
    }

    public void setGridParentMerchantMemberLayout(GridLayout gridParentMerchantMemberLayout) {
	this.gridParentMerchantMemberLayout = gridParentMerchantMemberLayout;
    }

    public Label getLblParentMerchantID() {
	return lblParentMerchantID;
    }

    public void setLblParentMerchantID(Label lblParentMerchantID) {
	this.lblParentMerchantID = lblParentMerchantID;
    }

    public Label getLblParentMerchantName() {
	return lblParentMerchantName;
    }

    public void setLblParentMerchantName(Label lblParentMerchantName) {
	this.lblParentMerchantName = lblParentMerchantName;
    }

    public Label getLblBusinessAddress() {
	return lblBusinessAddress;
    }

    public void setLblBusinessAddress(Label lblBusinessAddress) {
	this.lblBusinessAddress = lblBusinessAddress;
    }

    public Label getLblParentStatus() {
	return lblParentStatus;
    }

    public void setLblParentStatus(Label lblParentStatus) {
	this.lblParentStatus = lblParentStatus;
    }

    public Label getLblTitle() {
	return lblTitle;
    }

    public void setLblTitle(Label lblTitle) {
	this.lblTitle = lblTitle;
    }

    public Label getLblFirstName() {
	return lblFirstName;
    }

    public void setLblFirstName(Label lblFirstName) {
	this.lblFirstName = lblFirstName;
    }

    public Label getLblLastName() {
	return lblLastName;
    }

    public void setLblLastName(Label lblLastName) {
	this.lblLastName = lblLastName;
    }

    public Label getLblTelephoneNumber() {
	return lblTelephoneNumber;
    }

    public void setLblTelephoneNumber(Label lblTelephoneNumber) {
	this.lblTelephoneNumber = lblTelephoneNumber;
    }

    public Label getLblEmailAddress() {
	return lblEmailAddress;
    }

    public void setLblEmailAddress(Label lblEmailAddress) {
	this.lblEmailAddress = lblEmailAddress;
    }

    public TextField getTxtParentMerchantID() {
	return txtParentMerchantID;
    }

    public void setTxtParentMerchantID(TextField txtParentMerchantID) {
	this.txtParentMerchantID = txtParentMerchantID;
    }

    public TextField getTxtParentMerchantName() {
	return txtParentMerchantName;
    }

    public void setTxtParentMerchantName(TextField txtParentMerchantName) {
	this.txtParentMerchantName = txtParentMerchantName;
    }

    public TextArea getTxtBusinessAddress() {
	return txtBusinessAddress;
    }

    public void setTxtBusinessAddress(TextArea txtBusinessAddress) {
	this.txtBusinessAddress = txtBusinessAddress;
    }

    public ComboBox getCbbParentStatus() {
	return cbbParentStatus;
    }

    public void setCbbParentStatus(ComboBox cbbParentStatus) {
	this.cbbParentStatus = cbbParentStatus;
    }

    public ComboBox getCbbTitle() {
	return cbbTitle;
    }

    public void setCbbTitle(ComboBox cbbTitle) {
	this.cbbTitle = cbbTitle;
    }

    public TextField getTxtFirstName() {
	return txtFirstName;
    }

    public void setTxtFirstName(TextField txtFirstName) {
	this.txtFirstName = txtFirstName;
    }

    public TextField getTxtLastName() {
	return txtLastName;
    }

    public void setTxtLastName(TextField txtLastName) {
	this.txtLastName = txtLastName;
    }

    public TextField getTxtTelephoneNumber() {
	return txtTelephoneNumber;
    }

    public void setTxtTelephoneNumber(TextField txtTelephoneNumber) {
	this.txtTelephoneNumber = txtTelephoneNumber;
    }

    public TextField getTxtEmailAddress() {
	return txtEmailAddress;
    }

    public void setTxtEmailAddress(TextField txtEmailAddress) {
	this.txtEmailAddress = txtEmailAddress;
    }

    public TablePanel getTableMerchantSelectedPanel() {
	return tableMerchantSelectedPanel;
    }

    public void setTableMerchantSelectedPanel(TablePanel tableMerchantSelectedPanel) {
	this.tableMerchantSelectedPanel = tableMerchantSelectedPanel;
    }

    public TableHeaderProperty gethNoSelected() {
	return hNoSelected;
    }

    public void sethNoSelected(TableHeaderProperty hNoSelected) {
	this.hNoSelected = hNoSelected;
    }

    public TableHeaderProperty gethMerchantIDSelected() {
	return hMerchantIDSelected;
    }

    public void sethMerchantIDSelected(TableHeaderProperty hMerchantIDSelected) {
	this.hMerchantIDSelected = hMerchantIDSelected;
    }

    public TableHeaderProperty gethMerchantCompanyNameSelected() {
	return hMerchantCompanyNameSelected;
    }

    public void sethMerchantCompanyNameSelected(TableHeaderProperty hMerchantCompanyNameSelected) {
	this.hMerchantCompanyNameSelected = hMerchantCompanyNameSelected;
    }

    public TableHeaderProperty gethMerchantUrlSelected() {
	return hMerchantUrlSelected;
    }

    public void sethMerchantUrlSelected(TableHeaderProperty hMerchantUrlSelected) {
	this.hMerchantUrlSelected = hMerchantUrlSelected;
    }

    public TableHeaderProperty gethMerchantContactPersonSelected() {
	return hMerchantContactPersonSelected;
    }

    public void sethMerchantContactPersonSelected(TableHeaderProperty hMerchantContactPersonSelected) {
	this.hMerchantContactPersonSelected = hMerchantContactPersonSelected;
    }

    public void setApp(VaadinApplicationObjectSupport app) {
	this.app = app;
    }

    public void setMasterDataBAO(MasterDataBAO masterDataBAO) {
	this.masterDataBAO = masterDataBAO;
    }

    public void setPropertyBAO(PropertyBAO propertyBAO) {
	this.propertyBAO = propertyBAO;
    }

    public void setMessageBAO(MessageBAO messageBAO) {
	this.messageBAO = messageBAO;
    }

    public void setMerchantProfileBAO(MerchantProfileBAO merchantProfileBAO) {
	this.merchantProfileBAO = merchantProfileBAO;
    }

    public void setParentMerchantBAO(ParentMerchantBAO parentMerchantBAO) {
	this.parentMerchantBAO = parentMerchantBAO;
    }

    @SuppressWarnings("rawtypes")
    public Map<Long, BeanItem> getSelectedBeanItemMap() {
	return selectedBeanItemMap;
    }

}
